package com.seafwg.springboot1.configuration;

import com.seafwg.springboot1.vo.Student;
import org.springframework.context.annotation.*;

/**
 * @Author seafwg
 * @Date 2022/3/20 10:59 下午
 * @Version 1.0
 * @description xxx
 */

@Configuration
// 使用@ImportResource时classpath:后面没有空格
@ImportResource(value = {"classpath:applicationContext.xml", "classpath:beans.xml"})

// 使用@PropertiesSource注解加载.properties文件时，要配合@ComponentScan扫描注解加载所要赋值的类
@PropertySource("classpath:application.properties")
@ComponentScan(value = "com.seafwg.springboot1.vo")
public class SpringConfig {

    @Bean(name = "wenbaobao")
    public Student creatStudent() {
        Student student = new Student();
        student.setId(0002);
        student.setName("文宝宝");
        student.setAge(23);

        return student;
    }
}
